<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="frm.ssh.util.page.SearchBean"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
	<head>
		<script language="javascript" src="<%=contextPath%>/js/func.js"type=""></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script>
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '查询',
				            icon:"<%=contextPath%>/images/query.gif",
				            handler:cmt
				        
				        },'-', 
						{
				            text: '审核通过',
				            icon:"<%=contextPath%>/" + "images/editlink.gif",
				            handler:PL_SH,
							hidden:<%=session.getAttribute("btn_delete_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-', 
				        {
				            text: '删除',
				            icon:"<%=contextPath%>/images/delete.gif",
				            handler:deleteIt,
				            hidden:<%=session.getAttribute("btn_delete_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        }
			    	]
			    });
			});
		</script>
	</head>
	<body>
	<div id = "tbar" style="position:absolute;display:block left:0px; top:0px; width:100%; height:8%; z-index:1;"></div>
	<br>
	<div id="Layer" style="position:absolute;display:block left:0px; top:36px; width:100%; height:92%; z-index:1000; overflow:auto;">
		<form id="frmM"   name="frmM" method="POST" action="">
			<input type="hidden" name="searchBean.displayFlag" value="${searchBean.displayFlag}"/>
			<input type="hidden" name="conditionHtml" />
			<table width="100%" id="contab">
				<tr>
					<th width="120">
						操作时间：
					</th>
					<td>
						<input type="text" readonly="true" name="searchBean.con2" size="12" onclick="{img_con1.click()}" id="searchBean.con2" value="${searchBean.con2}"/>
						<img id="img_con1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('searchBean.con2')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
						&nbsp;
						至
						&nbsp;
						<input type="text" readonly="true"  onclick="{img_con2.click()}" size="12" name="searchBean.con3" id="searchBean.con3" value="${searchBean.con3}"/>
						<img id="img_con2" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('searchBean.con3')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					
				</tr>

			</table>
			<hr>
			<table width="100%" id="listtab">
				<tr>
					<th   width="25">
						<input name="chkAll" type="checkbox" id="chkAll"
							onclick="javascript:checkAll(this.form, 'id_sno');" value="checkbox">
					</th>
					<th   width="120">票号</th>
					<th   width="120">编写人员</th>
					<th   width="120">审批人员</th>
					<th   >已检查的安全工器具</th>
					<th   >审核状态</th>
					<!--
					<th   width="10%" nowrap>MAC</th>
					<th   width="10%" nowrap>IP地址</th>
					<th   width="10%" nowrap>机器名称</th>-->
				</tr>
				
				<c:forEach items="${list}" var="card" >
					<tr ondblclick="javascript:toDetail('<c:out value="${card.id_sno}"/>')">
						<td width="25" >
							<input type="checkbox" name="id_sno"  value="<c:out value="${card.id_sno}"/>"/>
						<br></td>
						<td   width="120"><c:out value="${card.pno}"/></td>
						<td   width="120"><c:out value="${card.bxr}"/></td>
						<td   width="120"><c:out value="${card.sp}"/></td>
						<td   ><c:out value="${card.check_tools}"/></td>						
						<td   width="100">
						<c:choose>
							<c:when test="${card.sh_status == '0'}">审核不通过</c:when>
							<c:when test="${card.sh_status == '1'}">审核通过</c:when>
							<c:when test="${card.sh_status == '2'}">待审核</c:when>
						</c:choose>						
						</td>
					</tr>
				</c:forEach>

				<c:if test="${list == null || fn:length(list) == 0 }">
					<tr>
						<td colspan="9" style="text-align: center">
							无相关记录
						</td>
					</tr>
				</c:if>
			</table>
			<hr>
			<table width="100%">
				<tr>
					<td>${pageDown}</td>
				</tr>
			</table>
		</form>
		</div>
	</body>
</html>
<script language="javascript">

			// 查询
			function cmt(){
				//document.frmM.elements["conditionHtml"].value = document.getElementById("sp").innerHTML; 
				document.frmM.action = "<%=contextPath%>/workcardOneList!getList.do";//&page=1&searchBean.conAdvance=" + getWhere();
				document.frmM.submit();
			}
	   		// 新建修改进入详细页面
			function toDetail(id){
				//location.href = "<%=contextPath%>/workcardOne!updateWorkcardOne.do?id="+id;
				parent.addTab("班组作业控制卡（一种票）", "<%=contextPath%>/workcardOne!updateWorkcardOne.do?id="+id,id);
	    
			}
			// 删除
			function deleteIt()
			{
				if(!isChecked("id_sno")) {
		 			alert("请选择要删除班组作业控制卡！");
		 			return false;
		 		}
		    	if(confirm("确定要删除选中的班组作业控制卡吗？")) {
					//id1 = getCheckValue("id_sno");//获取id值
			
					var checked=getCheckBoxInformation();
		        	document.frmM.action = "<%=contextPath%>/workcardOne!deleteWorkcardOne.do?id="+checked;
					document.frmM.submit();
		    	}
			}
			// 批量审核
			function PL_SH()
			{
				if(!isChecked("id_sno")) {
		 			alert("请选择要审核的班组作业控制卡！");
		 			return false;
		 		}
		    	if(confirm("确定要将选中的班组作业控制卡审核通过吗？")) {
					var checked=getCheckBoxInformation();
		        	document.frmM.action = "<%=contextPath%>/workcardOne!verifyWorkcardOne_PL.do?id="+checked;
					document.frmM.submit();
		    	}
			}			
			function getCheckBoxInformation() { 
				   var checkboxes = document.getElementsByName("id_sno"); 
				   var checkedStr = ""; 
				   var uncheckedStr = ""; 
				   var url = ""; 
				   var num=0;
				   for(var i = 0; i < checkboxes.length; i++) { 
					   var checkbox = checkboxes[i]; 
					   if(checkbox.checked) { 
					   
					   if(num>0)
						  checkedStr = checkedStr + ",'" + checkbox.value+"'"; 
						else
						 checkedStr ="'"+checkbox.value+"'"; 						 
						  num=num+1;
					  }else { 
						  uncheckedStr = uncheckedStr + "," + checkbox.value; 
					  } 
				  } 
				   
				   if(checkedStr==""||checkedStr==null){
					//alert("请选择数据！");
					return '';
				   }else{
				   //window.location="bbr_ldmz_detail.jsp?txt_id="+checkedStr+"&temp="+Math.random();
				   return checkedStr;
				   }
				   //alert(checkedStr);
				  //document.form1.now_selected.value = checkedStr; 
				  //document.form1.no_selected.value = uncheckedStr; 
				}

		</script>